package tobsn.locationcalendar.map.overlays;

import java.util.ArrayList;
import java.util.List;

import android.graphics.drawable.Drawable;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

public class CurrenLocationOverlay extends ItemizedOverlay<OverlayItem> {

	private List<OverlayItem> mOverlayItems = new ArrayList<OverlayItem>();

	public CurrenLocationOverlay(Drawable defaultMarker) {
		super(boundCenter(defaultMarker));
		populate();
	}

	/**
	 * Updates the position of the Drawable to the given Point.
	 * 
	 * @param newPosition
	 */
	public void updatePosition(GeoPoint newPosition) {
		OverlayItem item = new OverlayItem(newPosition, null, null);
		mOverlayItems.clear();
		mOverlayItems.add(item);
		populate();
	}

	@Override
	protected OverlayItem createItem(int i) {
		return mOverlayItems.get(i);
	}

	@Override
	public int size() {
		return mOverlayItems.size();
	}

}
